<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right" style="fontsize: 14px">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-table
        ref="singleTable"
        :data="tableData"
        highlight-current-row
        style="width: 100%"
        :border="true"
        stripe
      >
        <el-table-column type="index" label="#" width="50"> </el-table-column>

        <el-table-column property="authName" label="权限名称" width="400">
        </el-table-column>
        <el-table-column property="path" label="路径" width="400">
        </el-table-column>
        <el-table-column property="level" label="权限等级">
          <template slot-scope="{ row: { level } }">
            <el-tag
              v-if="level === '0'"
              type="primary"
              plain
              size="small"
              class="btn"
              >等级一</el-tag
            >
            <el-tag v-else-if="level === '1'" type="success" plain size="small"
              >等级二</el-tag
            ><el-tag v-else-if="level === '2'" type="warning" plain size="small"
              >等级三</el-tag
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getRights } from "@/api/power";
export default {
  name: "",
  components: {},
  props: {},
  data() {
    return {
      tableData: [],
      currentRow: null,
    };
  },
  computed: {},
  watch: {},
  created() {
    this.loadGetRights();
  },
  mounted() {},
  methods: {
    async loadGetRights() {
      const result = await getRights("list");
      this.tableData = result;
    },
    showRow(row) {
      console.log(row);
    },
  },
};
</script>

<style scoped lang="less">
// .btn {
//   &:hover {
//     background-color: unset;
//   }
//   padding: 8px;
// }
</style>
